Skip to content

[FEATURE] add air_constants, convert_room_quantity and din18041 to pytta.rooms - #99

Open
aguirreSL wants to merge 1 commit into
PyTTaMaster:developmentfrom
aguirreSL:dev-room_tools
Open

aguirreSL wants to merge 1 commit into
PyTTaMaster:developmentfrom
aguirreSL:dev-room_tools

Conversation

@aguirreSL

Copy link
Copy Markdown

Adds three room tools of the ITA-Toolbox to pytta.rooms:

  1. air_constants(temperature=20, humidity=0.5, pressure=101325): the speed of sound, density and characteristic impedance of humid air, as ita_constants. The gas constant of the air includes the molar concentration of water vapour of ISO 9613-1, with c = sqrt(1.4 R T) and ρ = p / (R T). The power attenuation of air is pytta.iso354.power_attenuation ([FEATURE] add pytta.iso9613 and pytta.iso354 for air and room absorption #78), so it is not repeated here.
  2. convert_room_quantity(value, source, target, volume, surface, formula='eyring'): conversion between reverberation time, absorption coefficient, normal-incidence reflection factor and surface impedance, as ita_convert_RT_alpha_R_Z. T and alpha are related by Eyring or Sabine in both directions. ita_convert_RT_alpha_R_Z goes from T to alpha by Eyring and back by Sabine with air absorption, so its two directions do not invert each other. Then alpha = 1 - |R|², R = sqrt(1 - alpha) (real, since the phase is not known) and Z = z0 (1 + R) / (1 - R).
  3. din18041(volume, purpose='speech', frequencies=None): the recommended reverberation time T_soll = a lg V + b and its tolerance band by frequency for rooms for music, speech and education, as ita_din18041_reverberation_times. That function follows DIN 18041:2004. The 2016 edition, with groups A1 to A5, was not available and is not implemented.

ita_roomacoustics_H (H = -C50 in the 1 kHz octave) is left for when C50 is available outside RoomAnalysis. ita_roomacoustics_hirata is left out, since its own header lists it as unfinished.

The tests in tests/test_room_tools.py print the measured differences:

  1. c, ρ and z0 at three conditions (20 °C and 50 %, 0 °C dry, 35 °C and 90 % at 95 kPa) are those of ita_constants, on golden data from tests/golden/make_room_tools_ita.m (MATLAB R2026b). Dry air at 0 °C gives 331.23 m/s.
  2. T to alpha and back returns T by both formulas, R = 0 is alpha = 1 and Z = z0, alpha = 0.75 gives R = 0.5 and Z = 3 z0, and Eyring tends to Sabine for small alpha.
  3. T_soll is 0.37 lg V - 0.14 for speech, and the tolerance bands for speech and music are those of ita_din18041_reverberation_times (3.3e-16).

Checked with Python 3.12, numpy 1.26 and scipy 1.17. The 7 failures of development (3 in test_h5io.py, 4 in test_pyttasave.py) are the same with and without this change.

Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com

…tta.rooms

air_constants gives the speed of sound, density and impedance of humid
air as ita_constants of the ITA-Toolbox. convert_room_quantity converts
between reverberation time, absorption coefficient, reflection factor
and surface impedance, as ita_convert_RT_alpha_R_Z, with the same
formula (Eyring or Sabine) in both directions. din18041 gives the
recommended reverberation time and its tolerance band of DIN 18041:2004,
as ita_din18041_reverberation_times.

Tests check the constants and the DIN 18041 band against the ITA-Toolbox
on golden data from tests/golden/make_room_tools_ita.m (identical), and
that the conversions are consistent in both directions.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant